package com.bnz.pojo;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.Date;


@AllArgsConstructor
@NoArgsConstructor
@Data
public class Student {

    //使用雪花算法生成的id，，适用于分布式项目。
    @TableId(type = IdType.ASSIGN_ID)
    private String sid;
    private String sname;

    private String sex;
    private Integer age;
    private String addr;
    private Integer cid;

    //自动填充 插入修改时间。
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
    //逻辑删除字段
    @TableLogic
    private Integer deleted;

    @TableField(exist = false)   //表的字段不存在。
    private String cname;

    public Student(String sname, String sex, Integer age, String addr, Integer cid) {
        this.sname = sname;
        this.sex = sex;
        this.age = age;
        this.addr = addr;
        this.cid = cid;
    }
}
